//
//  TouchView.m
//  action设计模式
//
//  Created by Scott on 15/4/22.
//  Copyright (c) 2015年 www.lanou3g.com 蓝欧3G. All rights reserved.
//

#import "TouchView.h"

@implementation TouchView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
    }
    
    return self;
}



/* 重写 touchesEnded 方法 */
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    /* 让绑定的对象(target)去执行相应的方法  */
    [self.target performSelector:self.action withObject:self];

}

- (void)addTarget:(id)target action:(SEL)action
{
    
    self.target = target;
    self.action = action;
    
}



/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
